﻿using System;
using System.Collections.Generic;
using System.Text;
using WinFormsApp1.Interface;

namespace WinFormsApp1
{
    class Triangle : Shape
    {
        private double Tength1;
        private double Tength2;
        private double Tength3;

        public Triangle()
        {

        }

        public Triangle(double tength1, double tength2, double tength3)
        {
            Tength1 = tength1;
            Tength2 = tength2;
            Tength3 = tength3;
        }
        //调试
        public double getTength1()
        {
            return Tength1;
        }
        public void setTength1(double Tength1)
        {
            this.Tength1 = Tength1;
        }
        public void setTength2(double Tength2)
        {
            this.Tength2 = Tength2;
        }
        public void setTength3(double Tength3)
        {
            this.Tength3 = Tength3;
        }
        //计算公式
        //1/4sqrt[(a+b+c)(a+b-c)(a+c-b)(b+c-a)]
        public double CalculatedArea()
        {
            double a = 0.25 * Math.Sqrt(((Tength1 + Tength2 + Tength3) * (Tength1 + Tength2 - Tength3) * (Tength1 + Tength3 - Tength2) * (Tength2 + Tength3 - Tength1)));
            return a;
        }

        public bool isReasonable()
        {
            return (Tength1 > 0 && Tength2 > 0 && Tength2 > 0 && Tength1 + Tength2 > Tength3 && Tength1 + Tength3 > Tength2 && Tength3 + Tength2 > Tength1);
        }
    }
}
